-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ecs_cluster integration test #1145
fix ecs_cluster integration test #1145
Conversation
It looks like the permissions were also not sufficient |
Is there something wrong with |
@markuman As far as I am aware, the only policies that are applied are the ones in https://github.com/mattclay/aws-terminator/tree/master/aws/policy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I run the tests locally and they pass. There are two tasks failing and masked by ignore_errors: true
. Don't we also need to camelize the returned result?
TASK [ecs_cluster : create same ECS service definition (should not change)] **********************************************************
task path: /Users/alinabuzachis/dev/collections/ansible_collections/community/aws/tests/output/.tmp/integration/ecs_cluster-1n9q2tio-ÅÑŚÌβŁÈ/tests/integration/targets/ecs_cluster/tasks/full_test.yml:217
Using module file /Users/alinabuzachis/dev/collections/ansible_collections/community/aws/plugins/modules/ecs_service.py
Pipelining is enabled.
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: alinabuzachis
<testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /Users/alinabuzachis/anaconda3/envs/py38/bin/python && sleep 0'
changed: [testhost] => {
"changed": true,
"invocation": {
"module_args": {
"aws_access_key": "xxx",
"aws_ca_bundle": null,
"aws_config": null,
"aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"client_token": "",
"cluster": "ansible-test-25844396-alinas-macbook-pro",
"debug_botocore_endpoint_logs": true,
"delay": 10,
"deployment_configuration": {
"maximum_percent": 100,
"minimum_healthy_percent": 0
},
"desired_count": 1,
"ec2_url": null,
"force_deletion": false,
"force_new_deployment": false,
"health_check_grace_period_seconds": 60,
"launch_type": null,
"load_balancers": [
{
"containerName": "ansible-test-25844396-alinas-macbook-pro-task",
"containerPort": 8080,
"targetGroupArn": "xxx"
}
],
"name": "ansible-test-25844396-alinas-macbook-pro-service",
"network_configuration": null,
"placement_constraints": [],
"placement_strategy": [
{
"field": "memory",
"type": "binpack"
},
{
"field": "attribute:ecs.availability-zone",
"type": "spread"
}
],
"platform_version": null,
"profile": null,
"region": "us-east-1",
"repeat": 10,
"role": "ecsServiceRole",
"scheduling_strategy": null,
"security_token": null,
"service_registries": [],
"state": "present",
"task_definition": "ansible-test-25844396-alinas-macbook-pro-task:2",
"validate_certs": true
}
},
"resource_actions": [
"ecs:DescribeServices",
"ecs:UpdateService"
],
"service": {
"clusterArn": "xxx",
"createdAt": "2022-05-12 10:41:58.171000+02:00",
"createdBy": "xxxx",
"deploymentConfiguration": {
"deploymentCircuitBreaker": {
"enable": false,
"rollback": false
},
"maximumPercent": 100,
"minimumHealthyPercent": 0
},
"deployments": [
{
"createdAt": "2022-05-12 10:41:58.171000+02:00",
"desiredCount": 1,
"failedTasks": 0,
"id": "ecs-svc/2450666585425580140",
"launchType": "EC2",
"pendingCount": 0,
"rolloutState": "IN_PROGRESS",
"rolloutStateReason": "ECS deployment ecs-svc/2450666585425580140 in progress.",
"runningCount": 0,
"status": "PRIMARY",
"taskDefinition": "xxxx",
"updatedAt": "2022-05-12 10:41:58.171000+02:00"
}
],
"desiredCount": 1,
"enableECSManagedTags": false,
"enableExecuteCommand": false,
"events": [],
"healthCheckGracePeriodSeconds": 60,
"launchType": "EC2",
"loadBalancers": [
{
"containerName": "ansible-test-25844396-alinas-macbook-pro-task",
"containerPort": 8080,
"targetGroupArn": "xxxx"
}
],
"pendingCount": 0,
"placementConstraints": [],
"placementStrategy": [
{
"field": "MEMORY",
"type": "binpack"
},
{
"field": "attribute:ecs.availability-zone",
"type": "spread"
}
],
"propagateTags": "NONE",
"roleArn": "xxx",
"runningCount": 0,
"schedulingStrategy": "REPLICA",
"serviceArn": "xxxx",
"serviceName": "ansible-test-25844396-alinas-macbook-pro-service",
"serviceRegistries": [],
"status": "ACTIVE",
"taskDefinition": "xxxx"
}
}
TASK [ecs_cluster : check that ECS service recreation changed nothing] ***************************************************************
task path: /Users/alinabuzachis/dev/collections/ansible_collections/community/aws/tests/output/.tmp/integration/ecs_cluster-1n9q2tio-ÅÑŚÌβŁÈ/tests/integration/targets/ecs_cluster/tasks/full_test.yml:234
fatal: [testhost]: FAILED! => {
"assertion": "not ecs_service_again.changed",
"changed": false,
"evaluated_to": false,
"msg": "Assertion failed"
}
...ignoring
TASK [ecs_cluster : attempt to use ECS network configuration on task definition without awsvpc network_mode] *************************
task path: /Users/alinabuzachis/dev/collections/ansible_collections/community/aws/tests/output/.tmp/integration/ecs_cluster-1n9q2tio-ÅÑŚÌβŁÈ/tests/integration/targets/ecs_cluster/tasks/full_test.yml:268
Using module file /Users/alinabuzachis/dev/collections/ansible_collections/community/aws/plugins/modules/ecs_service.py
Pipelining is enabled.
<testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /Users/alinabuzachis/anaconda3/envs/py38/bin/python && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_ecs_service_payload_4uo1q45p/ansible_ecs_service_payload.zip/ansible_collections/community/aws/plugins/modules/ecs_service.py", line 780, in main
File "/tmp/ansible_ecs_service_payload_4uo1q45p/ansible_ecs_service_payload.zip/ansible_collections/community/aws/plugins/modules/ecs_service.py", line 599, in create_service
File "/Users/alinabuzachis/anaconda3/envs/py38/lib/python3.8/site-packages/botocore/client.py", line 415, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/alinabuzachis/anaconda3/envs/py38/lib/python3.8/site-packages/botocore/client.py", line 745, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the CreateService operation: Network Configuration is not valid for the given networkMode of this task definition.
fatal: [testhost]: FAILED! => {
"boto3_version": "1.21.36",
"botocore_version": "1.24.36",
"changed": false,
"error": {
"code": "InvalidParameterException",
"message": "Network Configuration is not valid for the given networkMode of this task definition."
},
"invocation": {
"module_args": {
"aws_access_key": "xxxx",
"aws_ca_bundle": null,
"aws_config": null,
"aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"client_token": "",
"cluster": "ansible-test-25844396-alinas-macbook-pro",
"debug_botocore_endpoint_logs": true,
"delay": 10,
"deployment_configuration": {
"maximum_percent": 100,
"minimum_healthy_percent": 0
},
"desired_count": 1,
"ec2_url": null,
"force_deletion": false,
"force_new_deployment": false,
"health_check_grace_period_seconds": null,
"launch_type": null,
"load_balancers": [
{
"containerName": "ansible-test-25844396-alinas-macbook-pro-task",
"containerPort": 8080,
"targetGroupArn": "xxxx"
}
],
"name": "ansible-test-25844396-alinas-macbook-pro-service3",
"network_configuration": {
"assign_public_ip": null,
"security_groups": [
"sg-0d8ba12678fc65168"
],
"subnets": [
"subnet-0b4a9a74d9611c7b0",
"subnet-013a944c5684affbd"
]
},
"placement_constraints": [],
"placement_strategy": [
{
"field": "memory",
"type": "binpack"
},
{
"field": "attribute:ecs.availability-zone",
"type": "spread"
}
],
"platform_version": null,
"profile": null,
"region": "us-east-1",
"repeat": 10,
"role": "",
"scheduling_strategy": null,
"security_token": null,
"service_registries": [],
"state": "present",
"task_definition": "ansible-test-25844396-alinas-macbook-pro-task:2",
"validate_certs": true
}
},
"msg": "Couldn't create service: An error occurred (InvalidParameterException) when calling the CreateService operation: Network Configuration is not valid for the given networkMode of this task definition.",
"resource_actions": [
"ecs:DescribeServices",
"ecs:CreateService"
],
"response_metadata": {
"http_headers": {
"connection": "close",
"content-length": "136",
"content-type": "application/x-amz-json-1.1",
"date": "Thu, 12 May 2022 08:42:02 GMT",
"x-amzn-requestid": "76f6580c-f56d-4c5d-a390-101232d10408"
},
"http_status_code": 400,
"request_id": "76f6580c-f56d-4c5d-a390-101232d10408",
"retry_attempts": 0
}
}
...ignoring
@alinabuzachis thx for test it.
I guess the first The second
I need investigate more. It might be a bug or a service limitation itself. Means, the network change miight not be possible - like changing ALB configuration (the task before). |
@alinabuzachis I've made some more clean-ups and hits some more bugs. |
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Backport to stable-2: 💚 backport PR created✅ Backport PR branch: Backported as #1153 🤖 @patchback |
fix ecs_cluster integration test SUMMARY ecs_cluster: make ecs_cluster integration test work again - as it is bugs I've hit and must be fixed to complete this challenge ecs_taskdefinition: fix change detection of changing launch_type parameter ecs_service: compare of task_definition never works and results always in a changed task change detect of health_check_grace_period_seconds was never implemented, but tested and failing, after the task_definition is compared correctly ref: #1142 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ecs_service ADDITIONAL INFORMATION basically the existing test tasks are not changed. just sorted and removed what was marked as fixme because it's simple not possible (changing network settings of a created service). Reviewed-by: Alina Buzachis <None> Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Markus Bergholz <[email protected]> (cherry picked from commit 35f4f59)
Backport to stable-3: 💚 backport PR created✅ Backport PR branch: Backported as #1154 🤖 @patchback |
fix ecs_cluster integration test SUMMARY ecs_cluster: make ecs_cluster integration test work again - as it is bugs I've hit and must be fixed to complete this challenge ecs_taskdefinition: fix change detection of changing launch_type parameter ecs_service: compare of task_definition never works and results always in a changed task change detect of health_check_grace_period_seconds was never implemented, but tested and failing, after the task_definition is compared correctly ref: #1142 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ecs_service ADDITIONAL INFORMATION basically the existing test tasks are not changed. just sorted and removed what was marked as fixme because it's simple not possible (changing network settings of a created service). Reviewed-by: Alina Buzachis <None> Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Markus Bergholz <[email protected]> (cherry picked from commit 35f4f59)
[PR #1145/35f4f592 backport][stable-3] fix ecs_cluster integration test This is a backport of PR #1145 as merged into main (35f4f59). SUMMARY ecs_cluster: make ecs_cluster integration test work again - as it is bugs I've hit and must be fixed to complete this challenge ecs_taskdefinition: fix change detection of changing launch_type parameter ecs_service: compare of task_definition never works and results always in a changed task change detect of health_check_grace_period_seconds was never implemented, but tested and failing, after the task_definition is compared correctly ref: #1142 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ecs_service ADDITIONAL INFORMATION basically the existing test tasks are not changed. just sorted and removed what was marked as fixme because it's simple not possible (changing network settings of a created service). Reviewed-by: Markus Bergholz <[email protected]>
[PR #1145/35f4f592 backport][stable-2] fix ecs_cluster integration test This is a backport of PR #1145 as merged into main (35f4f59). SUMMARY ecs_cluster: make ecs_cluster integration test work again - as it is bugs I've hit and must be fixed to complete this challenge ecs_taskdefinition: fix change detection of changing launch_type parameter ecs_service: compare of task_definition never works and results always in a changed task change detect of health_check_grace_period_seconds was never implemented, but tested and failing, after the task_definition is compared correctly ref: #1142 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ecs_service ADDITIONAL INFORMATION basically the existing test tasks are not changed. just sorted and removed what was marked as fixme because it's simple not possible (changing network settings of a created service). Reviewed-by: Markus Bergholz <[email protected]>
Enable ec2_metadata integration tests SUMMARY Enable ec2_metadata_facts integration tests ISSUE TYPE Feature Pull Request COMPONENT NAME ec2_metadata_facts ADDITIONAL INFORMATION As shown by ansible-collections#1138 we should try to ensure that the integration tests are enabled Reviewed-by: Alina Buzachis <None>
SUMMARY
launch_type
parametertask_definition
never works and results always in a changed taskhealth_check_grace_period_seconds
was never implemented, but tested and failing, after thetask_definition
is compared correctlyref: #1142
ISSUE TYPE
COMPONENT NAME
ecs_taskdefinition
ecs_service
ADDITIONAL INFORMATION
basically the existing test tasks are not changed. just sorted and removed what was marked as
fixme
because it's simple not possible (changing network settings of a created service).